package com.intelligence.openfeign.service.deivce;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.intelligence.entity.pojo.Device;
import com.intelligence.entity.pojo.DeviceLog;
import com.intelligence.entity.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * deviceLog的openFeign调用接口
 *
 * @Author : RulerWood
 * @Data : 2024/6/3 - 15:37
 */
@FeignClient(value = "system-device", contextId = "device", path = "/device/device")
public interface DeviceFeignService {

    @GetMapping("/pageDevice")
    Result<Page<Device>> pageDevice(@RequestParam(value = "offset", defaultValue = "1") Integer offset,
                                    @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize);

    @GetMapping("/listDevice")
    Result<Page<Device>> listDevice();


    @GetMapping("/getOneDevice/{id}")
    Result<Device> getOneDevice(@PathVariable(value = "id") Integer id);

    /**
     * 数据的新增
     *
     * @param device 保存对象
     * @return
     */
    @PostMapping("/saveDevice")
    Result saveDevice(@RequestBody Device device);

    @GetMapping("/listByMid")
    Result<List<Device>> listByMid(@RequestParam(value = "mid") Integer mid);

    /**
     * 数据的修改
     *
     * @param device 修改对象
     * @return
     */
    @PutMapping("/updateDevice")
    Result updateDevice(@RequestBody Device device);

    /**
     * 删除某条数据
     *
     * @param id 数据主键
     * @return
     */
    @DeleteMapping("/deleteDevice/{id}")
    Result deleteDevice(@PathVariable(value = "id") Integer id);

}
